import { createApp } from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import App from './App.vue'
import router from './router'
import store from './store'
import Cookies from 'js-cookie'

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import locale from 'element-plus/lib/locale/lang/zh-cn'

// 公共样式
import '@/assets/styles/index.scss'
import '@/assets/icons'

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
 if (process.env.NODE_ENV === 'production') {
  const { mockXHR } = require('../mock')
  mockXHR()
}

// 全局组件引入
import SvgIcon from '@/components/SvgIcon/index.vue'
// 创建app
const app = createApp(App)
// 注册ElementPlus
app.use(ElementPlus, {
    locale, // 语言设置
    size: Cookies.get('size') || 'medium' // 尺寸设置
})
// 全局组件祖册
app.component(
    'SvgIcon',
    // 如果这个组件选项是通过 `export default` 导出的，那么就会优先使用 `.default`，否则回退到使用模块的根
    SvgIcon.default || SvgIcon
  )
// 注册路由
app.use(store).use(router).mount('#app')
